<style scoped>
.list_outer{padding: 8px 16px;background: #fff;}
.list_row{border-top: 0.5px solid rgba(0,0,0,.2);padding: 2px;}
.list_row:first-child{border-top: none;}
.list_row .info{font-size: 0.8em;}
.list_row .top{font-size: 1.1em;line-height: 2;}
.list_row .top>b{color: var(--color-primary);}
.list_row .bottom{line-height: 2;color: var(--color-bg-re-r);}
.list_row .bottom [status="1"]{color: var(--color-primary);}
</style>
<template>
  <HeaderSlot>
    <van-nav-bar :title="$t('提现明细')" left-arrow @click-left="href_handle(-1)" />
  </HeaderSlot>
  <van-list v-model:loading="loading" :finished="finished" @load="list_loop" ref="list">
    <div class="list_outer">
      <div class="list_row" v-for="row in list">
        <div class="flex top">
          <p class="max">提现到：{{label_map[row.type]}}</p>
          <b>{{row.money}}（服务费-{{row.service_money}}）</b>
        </div>
        <div class="info">{{row.note_admin}}</div>
        <div class="flex bottom">
          <p class="max">{{row.create_time}}</p>
          <p :status="row.status">{{status_map[row.status]}}</p>
        </div>
      </div>
    </div>
    <van-empty v-show="list.length===0&&!loading" description="暂无记录" />
  </van-list>

</template>

<script>
import {ajax} from "@/js/api_tool.js";
import {href_handle} from "@/vue_plugin/router_auto.js";
import HeaderSlot from "@/components/slot/HeaderSlot.vue";

export default {
  components: {HeaderSlot},
  data(){
    return {
      label_map: {wechat:'微信', alipay:'支付宝', bank:'银行卡'},
      list: [],
      p:0,
      loading: false,
      finished: false,

      status_map: ['申请中','提现成功','拒绝提现'],
    }
  },
  methods:{
    href_handle,
    list_loop(){
      let data = {p:this.p, n:20};
      ajax({url:'/home/user/withdraw_list', data: data}, res=>{
        this.p++;
        // this.loading = false;
        setTimeout(()=>{ this.loading = false;}, 20);
        this.list = this.list.concat(res.data.list);
        if (res.data.list.length < data.n) this.finished = true;
        return false;
      })
    },
    init(){
      this.p = 0;
      this.over = false;
      this.list = [];
    },
  },
  computed:{},
  mounted(){
    // this.init();
  }
}
</script>